package com.youyi.yyfilepickerlibrary.core.util;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;

public class UiUtils {
    public static int dpToPx(Context context, float f) {
        return (int) TypedValue.applyDimension(1, f, context.getResources().getDisplayMetrics());
    }

    public static int getImageResize(Context context, RecyclerView recyclerView) {
        return context.getResources().getDisplayMetrics().widthPixels / ((GridLayoutManager) recyclerView.getLayoutManager()).getSpanCount();
    }
}
